package com.hs.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.sfzy.entity.Fm;
import com.hs.sfzy.mapper.FmMapper;
import com.hs.sfzy.service.FmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName FmServiceImpl
 * @Description TODO
 * @Author zgy
 * @Date 2024年10月22日 21:17
 * @Version 1.0
 */
@Service
public class FmServiceImpl implements FmService {
    @Autowired
    private FmMapper fmMapper;
    @Override
    public int insert(Fm fm) {
        return fmMapper.insert(fm);
    }

    @Override
    public int delete(int id) {
        return fmMapper.delete(id);
    }

    @Override
    public int update(Fm fm) {
        return fmMapper.update(fm);
    }

    @Override
    public List<Fm> selectAll(Fm fm) {
        return fmMapper.selectAll(fm);
    }

    @Override
    public Fm selectById(int id) {
        return fmMapper.selectById(id);
    }

    @Override
    public PageInfo<Fm> selectByPageInfo(int pageNum, int pageSize, Fm fm) {
        PageHelper.startPage(pageNum,pageSize);
        List<Fm> list = fmMapper.selectAll(fm);
        PageInfo<Fm> pageInfo = new PageInfo<Fm>(list);
        return pageInfo;
    }
}
